Skip to content

fix: update antlr4 CMAKE_POLICY from OLD to NEW for CMake 3.31+#145

Merged
Cuiyus merged 2 commits intoalibaba:mainfrom
aashish-thapa:fix/antlr4-cmake-policy-old-removed
Feb 27, 2026
Merged

fix: update antlr4 CMAKE_POLICY from OLD to NEW for CMake 3.31+#145
Cuiyus merged 2 commits intoalibaba:mainfrom
aashish-thapa:fix/antlr4-cmake-policy-old-removed

Conversation

@aashish-thapa
Copy link
Contributor

@aashish-thapa aashish-thapa commented Feb 17, 2026

Summary

  • Update antlr4.patch to change CMAKE_POLICY(SET ... OLD) to NEW for policies CMP0042, CMP0045, CMP0054, and CMP0059
  • CMake 3.31+ has removed support for the OLD behavior of these policies, causing a hard configuration error when building from source

Details

The OLD behavior for these policies has been deprecated since CMake 3.0/3.3 and was fully removed in CMake 3.31. Changing to NEW resolves the build failure without affecting functionality since NEW has been the default behavior for years.

Edit

Note: This fix resolves the CMake 3.31+ configuration error but does not address the separate RocksDB 8.1.1
compilation failure with GCC 15 (see #144 for details). Users on GCC 15 will still need to build with GCC 14 or
earlier (e.g., via the python:3.12 Docker image) until RocksDB is upgraded.

Test plan

  • Verified the build completes successfully using python:3.12 Docker image (GCC 14, CMake 3.31.10)
  • Full compilation of all 1098 targets passes
  • import zvec works correctly after installation

Fixes #144

…tibility

CMake 3.31+ has removed support for the OLD behavior of policies
CMP0042, CMP0045, CMP0054, and CMP0059. This causes a hard
configuration error when building from source with newer CMake versions.

Changing these to NEW resolves the build failure. The NEW behavior has
been the default since CMake 3.0/3.3 and does not affect functionality.

Fixes alibaba#144
@CLAassistant
Copy link

CLAassistant commented Feb 17, 2026

CLA assistant check
All committers have signed the CLA.

@Cuiyus Cuiyus self-requested a review February 26, 2026 12:50
@Cuiyus
Copy link
Collaborator

Cuiyus commented Feb 27, 2026

@greptile

@greptile-apps
Copy link

greptile-apps bot commented Feb 27, 2026

Greptile Summary

This PR fixes a critical build compatibility issue with CMake 3.31+ by updating the antlr4 patch to use NEW behavior for four CMake policies (CMP0042, CMP0045, CMP0054, CMP0059) instead of the now-unsupported OLD behavior. These policies were deprecated in CMake 3.0/3.3 and support for OLD was removed in CMake 3.31, causing build failures.

  • Changes four CMAKE_POLICY(SET ... OLD) directives to NEW in the antlr4 build configuration
  • Resolves hard configuration errors when building with CMake 3.31+
  • The NEW behavior has been the default for years, ensuring no functional impact
  • Successfully tested with CMake 3.31.10 and GCC 14 in python:3.12 Docker image

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - it resolves a critical build compatibility issue
  • The change is a straightforward compatibility fix that simply switches CMake policies from deprecated OLD behavior to NEW behavior, which has been the default for years. The OLD behavior is no longer supported in CMake 3.31+, making this change necessary. The author has tested the build successfully with CMake 3.31.10, and the NEW policy behavior has no functional impact since it's been the standard since CMake 3.0/3.3
  • No files require special attention

Important Files Changed

Filename Overview
thirdparty/antlr/antlr4.patch Updates CMake policies from deprecated OLD to NEW behavior for CMake 3.31+ compatibility - changes CMP0042, CMP0045, CMP0054, and CMP0059

Last reviewed commit: 9faf384

Copy link
Collaborator

@Cuiyus Cuiyus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@Cuiyus Cuiyus merged commit 0d84e30 into alibaba:main Feb 27, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build from source fails with GCC 15 and newer CMake

3 participants